package com.itheima.d3_collection_list;

import java.util.LinkedList;

public class ListTest3 {
    public static void main(String[] args) {
        //创建一个队列
        LinkedList<String> queue =new LinkedList<>();

        queue.addLast("1");
        queue.addLast("2");
        queue.addLast("3");
        queue.addLast("4");

        System.out.println(queue);

        System.out.println(queue.removeFirst());
        System.out.println(queue.removeFirst());
        System.out.println(queue.removeFirst());
        System.out.println(queue);

        System.out.println("------------------");

        //创建一个栈对象
        LinkedList<String> stack =new LinkedList<>();

        //压栈
        stack.push("第一个子弹");
        stack.push("第二个子弹");
        stack.push("第三个子弹");
        stack.push("第四个子弹");
        System.out.println(stack);
        //出栈
        System.out.println(stack.pop());
        System.out.println(stack.pop());
        System.out.println(stack);


    }
}
